//
//  ActivityListViewController.m
//  Douban
//
//  Created by y_小易 on 14-8-27.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "ActivityListViewController.h"
#import "ActivityListCell.h"
#import "ActivityDetailViewController.h"

#import "Activity.h"
#import "MBProgressHUD.h"
#import "DoubanAPIUrl.h"

#define kActivityCell @"activityCell"

@interface ActivityListViewController ()

@property (nonatomic,retain) NSMutableArray * activityArray;
@property (nonatomic,retain) MBProgressHUD * hud;

//发起网络请求
- (void)p_sendReuqest;
//设置loading
- (void)p_setupProgressHud;

@end

@implementation ActivityListViewController

- (void)dealloc
{
    self.activityArray = nil;
    self.hud = nil;
    [super dealloc];
}

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.navigationItem.title = @"活动";
    
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    self.activityArray = [NSMutableArray arrayWithCapacity:40];
    

    [self.tableView registerClass:[ActivityListCell class] forCellReuseIdentifier:kActivityCell];
}


- (void)p_setupProgressHud
{
    self.hud = [[[MBProgressHUD alloc] initWithView:self.view] autorelease];
    _hud.frame = self.view.bounds;
    _hud.minSize = CGSizeMake(100, 100);
    _hud.mode = MBProgressHUDModeIndeterminate;
    [self.view addSubview:_hud];
    
    [_hud show:YES];
}

#pragma mark --网络请求、数据处理--

//发起网络请求
- (void)p_sendReuqest
{
    
}


#pragma mark -- Table view data source --

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return 10;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    ActivityListCell *cell = [tableView dequeueReusableCellWithIdentifier:kActivityCell forIndexPath:indexPath];

    
    return cell;
}



- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 155;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    //进入活动详情页面
    ActivityDetailViewController * detailVC = [[ActivityDetailViewController alloc] init];
    [self.navigationController pushViewController:detailVC animated:YES];
    [detailVC release];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
